Einhugur Xml Plugin for Xojo

XPathQuery.EvaluateNumber Method

Evaluates query to a Number result.

EvaluateNumber(
   node as EinhugurXml.Node) as Double

Parameters

node
The node to run the XPath query on.

Returns

Double
Numeric result.

Remarks

Note that XPath queries can throw EinhugurXPathException.


// In this example we will use Pre-compiled XPath query to
// Select nodes.
// --------------------------------------------------------
var f as FolderItem = SpecialFolder.Resources.Child("xgconsole.xml")

if not f.Exists then
    MessageBox("Could not find file xgconsole.xml")
    return
end if

using EinhugurXml

// Most parts of the plugin do not Throw exceptions, but Loading XML
// document does as well as all XPath query functionality.
try
    var document as Document = Document.FromFile(f)
   
    var queryTimeouts as XPathQuery = new XPathQuery("sum(//Tool/@Timeout)")
   
    var sum as Double = queryTimeouts.EvaluateNumber(document)
   
    MessageBox("Sum of timeout's is: " + sum.ToString())
   
catch ex as EinhugurXmlParserException
MessageBox(ex.Message + " - Offset:" + ex.Offset.ToString())
catch ex as EinhugurXPathException
MessageBox(ex.Message + " - Offset:" + ex.Offset.ToString())
end try

See Also

XPathQuery Class